package com.ruoyi.system.V2.font.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.model.domain.CheckAccount;
import com.ruoyi.system.V2.font.mapper.CheckAccountMapper;
import com.ruoyi.system.V2.font.service.ICheckAccountService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 账号校验Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-10-06
 */
@Service
public class CheckAccountServiceImpl implements ICheckAccountService
{
    @Resource
    private CheckAccountMapper checkAccountMapper;

    /**
     * 查询账号校验
     * 
     * @param id 账号校验主键
     * @return 账号校验
     */
    @Override
    public CheckAccount selectCheckAccountById(Long id)
    {
        return checkAccountMapper.selectCheckAccountById(id);
    }

    /**
     * 查询账号校验列表
     * 
     * @param checkAccount 账号校验
     * @return 账号校验
     */
    @Override
    public List<CheckAccount> selectCheckAccountList(CheckAccount checkAccount)
    {
        return checkAccountMapper.selectCheckAccountList(checkAccount);
    }

    /**
     * 新增账号校验
     * 
     * @param checkAccount 账号校验
     * @return 结果
     */
    @Override
    public int insertCheckAccount(CheckAccount checkAccount)
    {
        Long userId = SecurityUtils.getUserId();
        checkAccount.setCreateId(userId);
        checkAccount.setCreateTime(DateUtils.getNowDate());
        return checkAccountMapper.insertCheckAccount(checkAccount);
    }

    /**
     * 修改账号校验
     * 
     * @param checkAccount 账号校验
     * @return 结果
     */
    @Override
    public int updateCheckAccount(CheckAccount checkAccount)
    {
        checkAccount.setUpdateTime(DateUtils.getNowDate());
        Long userId = SecurityUtils.getUserId();
        checkAccount.setUpdateId(userId);
        return checkAccountMapper.updateCheckAccount(checkAccount);
    }

    /**
     * 批量删除账号校验
     * 
     * @param ids 需要删除的账号校验主键
     * @return 结果
     */
    @Override
    public int deleteCheckAccountByIds(Long[] ids)
    {
        return checkAccountMapper.deleteCheckAccountByIds(ids);
    }

    /**
     * 删除账号校验信息
     * 
     * @param id 账号校验主键
     * @return 结果
     */
    @Override
    public int deleteCheckAccountById(Long id)
    {
        return checkAccountMapper.deleteCheckAccountById(id);
    }
}
